package web.servlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import web.misc.JsonHttpResponseWriter;
import data.dao.DataFacade;
import email.EmailFacade;

public abstract class AbstractJsonCapableServlet extends HttpServlet {

    protected static final String HOST = "http://swen90002-22.cis.unimelb.edu.au:8080/proj2";

    protected DataFacade dataLayer;

    protected EmailFacade emailLayer;

    protected JsonHttpResponseWriter jsonHandler;

    @Override
    public void init(ServletConfig config) throws ServletException {
        this.dataLayer = (DataFacade) config.getServletContext().getAttribute("dataLayer");
        this.emailLayer = (EmailFacade) config.getServletContext().getAttribute("emailLayer");
        this.jsonHandler = (JsonHttpResponseWriter) config.getServletContext().getAttribute("jsonHandler");
    }

}
